home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / catD / strategy.z / strategy
Encoding:
Text File  |  1998-10-30  |  10.2 KB  |  132 lines

  1.  
  2.  
  3.  
  4. ssssttttrrrraaaatttteeeeggggyyyy((((DDDD2222))))                                                      ssssttttrrrraaaatttteeeeggggyyyy((((DDDD2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy - perform block I/O
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_bbbb_uuuu_ffff_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_eeee_rrrr_rrrr_nnnn_oooo_...._hhhh_>>>>
  15.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
  16.      _iiii_nnnn_tttt _p_r_e_f_i_x_ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy_((((_ssss_tttt_rrrr_uuuu_cccc_tttt _bbbb_uuuu_ffff _****_b_p_))))_;;;;
  17.  
  18.    AAAArrrrgggguuuummmmeeeennnnttttssss
  19.      _b_p        Pointer to the buffer header structure.
  20.  
  21. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  22.      The _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine is called by the kernel to read and write blocks of
  23.      data on the block device.  _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy may also be called directly or
  24.      indirectly (via a call to the _pppp_hhhh_yyyy_ssss_iiii_oooo_cccc_kkkk(D3) function) to support the raw
  25.      character interface of a block device from _rrrr_eeee_aaaa_dddd(D2), _wwww_rrrr_iiii_tttt_eeee(D2) or
  26.      _iiii_oooo_cccc_tttt_llll(D2).  The _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine's responsibility is to set up and
  27.      initiate the data transfer.
  28.  
  29.    RRRReeeettttuuuurrrrnnnn VVVVaaaalllluuuueeeessss
  30.      Ignored.  Errors are returned by using the _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr(D3) function to mark
  31.      the buffer as being in error.  On systems where the _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr function is
  32.      not available, errors can be returned by setting the _BBBB______EEEE_RRRR_RRRR_OOOO_RRRR flag in the
  33.      _bbbb______ffff_llll_aaaa_gggg_ssss field of the _bbbb_uuuu_ffff structure, and setting the error number in the
  34.      _bbbb______eeee_rrrr_rrrr_oooo_rrrr field of the _bbbb_uuuu_ffff structure.
  35.  
  36. UUUUSSSSAAAAGGGGEEEE
  37.      This entry point is required in all block device drivers.
  38.  
  39.      Generally, the first validation test performed by the _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine is
  40.      to see if the I/O is within the bounds of the device.  If the starting
  41.      block number, given by _bbbb_pppp_----_>>>>_bbbb______bbbb_llll_kkkk_nnnn_oooo, is less than 0 or greater than the
  42.      number of blocks on the device, the error number in the buffer header
  43.      should be set to _EEEE_NNNN_XXXX_IIII_OOOO, and the _BBBB______EEEE_RRRR_RRRR_OOOO_RRRR flag should be set in _bbbb_pppp_----
  44.      _>>>>_bbbb______ffff_llll_aaaa_gggg_ssss.  If the _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr routine is available, _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr should be used
  45.      to set the buffer error number to _EEEE_NNNN_XXXX_IIII_OOOO.  Then, the buffer should be
  46.      marked done by calling _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee(D3), and the driver should return.  If
  47.      _bbbb_pppp_----_>>>>_bbbb______bbbb_llll_kkkk_nnnn_oooo is equal to the number of blocks on the device and the
  48.      operation is a write, indicated by the absence of the _BBBB______RRRR_EEEE_AAAA_DDDD flag in _bbbb_pppp_----
  49.      _>>>>_bbbb______ffff_llll_aaaa_gggg_ssss (_!!!!_((((_bbbb_pppp_----_>>>>_bbbb______ffff_llll_aaaa_gggg_ssss _&&&& _BBBB______RRRR_EEEE_AAAA_DDDD_))))), then the same action should be taken.
  50.      However, if the operation is a read and _bbbb_pppp_----_>>>>_bbbb______bbbb_llll_kkkk_nnnn_oooo is equal to the
  51.      number of blocks on the device, then the driver should set _bbbb_pppp_----_>>>>_bbbb______rrrr_eeee_ssss_iiii_dddd
  52.      equal to _bbbb_pppp_----_>>>>_bbbb______bbbb_cccc_oooo_uuuu_nnnn_tttt, mark the buffer done by calling _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee, and
  53.      return.  This will cause the read to return 0.
  54.  
  55.      Once the I/O request has been validated, the _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine should
  56.      queue the request.  If there is not already a transfer under way, the I/O
  57.      is started.  Then the _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine returns.  When the I/O is
  58.      complete, the driver will call _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee to free the buffer and notify
  59.      anyone who has called _bbbb_iiii_oooo_wwww_aaaa_iiii_tttt(D3) to wait for the I/O to finish.
  60.  
  61.  
  62.                                                                         PPPPaaaaggggeeee 1111
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. ssssttttrrrraaaatttteeeeggggyyyy((((DDDD2222))))                                                      ssssttttrrrraaaatttteeeeggggyyyy((((DDDD2222))))
  70.  
  71.  
  72.  
  73.      There are two kinds of I/O requests passed to _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routines:  normal
  74.      block I/O requests and paged-I/O requests.  Normal block I/O requests are
  75.      identified by the absence of the _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO flag or the presence of the
  76.      _BBBB______MMMM_AAAA_PPPP_PPPP_EEEE_DDDD in _bbbb_pppp_----_>>>>_bbbb______ffff_llll_aaaa_gggg_ssss.  Here, the starting kernel virtual address of
  77.      the data transfer will be found in _bbbb_pppp_----_>>>>_bbbb______uuuu_nnnn_...._bbbb______aaaa_dddd_dddd_rrrr.  Paged-I/O requests
  78.      are identified by the presence of the _BBBB______PPPP_AAAA_GGGG_EEEE_IIII_OOOO flag in _bbbb_pppp_----_>>>>_bbbb______ffff_llll_aaaa_gggg_ssss.  The
  79.      driver has several ways to perform a paged-I/O request.
  80.  
  81.      If the driver wants to use virtual addresses, it can call _bbbb_pppp______mmmm_aaaa_pppp_iiii_nnnn(D3) to
  82.      get a virtually contiguous mapping for the pages.  The physical address
  83.      can be obtained by calling _kkkk_vvvv_tttt_oooo_pppp_hhhh_yyyy_ssss(D3X) for each page in the virtual
  84.      address range.
  85.  
  86.      If the amount of data to be transferred is more than can be transferred,
  87.      the driver can transfer as much as possible (if it supports partial reads
  88.      and writes), and then use the _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr function to set the buffer error
  89.      number to EIO.  If the _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr function is not available, the driver
  90.      should then set the _BBBB______EEEE_RRRR_RRRR_OOOO_RRRR flag, and set _bbbb_pppp_----_>>>>_bbbb______rrrr_eeee_ssss_iiii_dddd equal to the number
  91.      of bytes not transferred (if all of the data were transferred, _bbbb_pppp_----
  92.      _>>>>_bbbb______rrrr_eeee_ssss_iiii_dddd should be set to 0).
  93.  
  94.    SSSSyyyynnnncccchhhhrrrroooonnnniiiizzzzaaaattttiiiioooonnnn CCCCoooonnnnssssttttrrrraaaaiiiinnnnttttssss
  95.      The _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy entry point has the necessary context to sleep, but it
  96.      cannot assume it is called from the same context of the process that
  97.      initiated the I/O request.  Furthermore, the process that initiated the
  98.      I/O might not even be in existence when the _ssss_tttt_rrrr_aaaa_tttt_eeee_gggg_yyyy routine is called.
  99.  
  100. RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
  101.      _bbbb_iiii_oooo_dddd_oooo_nnnn_eeee(D3), _bbbb_iiii_oooo_eeee_rrrr_rrrr_oooo_rrrr(D3), _bbbb_iiii_oooo_wwww_aaaa_iiii_tttt(D3), _bbbb_pppp______mmmm_aaaa_pppp_iiii_nnnn(D3), _bbbb_uuuu_ffff(D4),
  102.      _dddd_eeee_vvvv_ffff_llll_aaaa_gggg(D1), _eeee_rrrr_rrrr_nnnn_oooo_ssss(D5), _kkkk_vvvv_tttt_oooo_pppp_hhhh_yyyy_ssss(D3X), _pppp_hhhh_yyyy_ssss_iiii_oooo_cccc_kkkk(D3), _rrrr_eeee_aaaa_dddd(D2), _wwww_rrrr_iiii_tttt_eeee(D2)
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.                                                                         PPPPaaaaggggeeee 2222
  129.  
  130.  
  131.  
  132.